import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from "../views/Login";
import ArticleList from "../components/article/ArticleList";
import ArticlePublish from "../components/article/ArticlePublish";
import CategoryManage from "../components/category/CategoryManage";
import DataStatistics from "../components/DataStatistics/DataStatistics";
import UserManage from "../components/UserManger/UserManage";

Vue.use(VueRouter)

  const routes = [
    {
      path: '/home',
      name: 'Home',
      component: Home,
      hidden:true,
    },

    {
      path: '/',
      name: 'Login',
      component: Login,
      hidden:true,
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      meta: {
          hasChild: true,
          title: "文章管理",
          icon : 'fa fa-file font-margin',
          roles : ['ROLE_admin','ROLE_dba','ROLE_user']
      },
      children: [
          {
              path: '/ArticleList',
              name: 'ArticleList',
              component: ArticleList,
              meta: {
                  title: '文章列表',
                  roles : ['ROLE_admin','ROLE_dba','ROLE_user']
              }

          },
          {
              path: '/ArticlePublish',
              name: 'ArticlePublish',
              component: ArticlePublish,
              meta: {
                  title: '文章发布',
                  roles : ['ROLE_admin','ROLE_dba','ROLE_user']
              }
          },
      ],
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      meta: {
          hasChild:false,
      },
      children: [
          {
              path: '/CategoryManage',
              name: 'CategoryManage',
              component: CategoryManage,
              meta: {
                  title: '栏目管理',
                  icon :'fa fa-th-large font-margin',
                  roles : ['ROLE_admin','ROLE_dba']
              }
          },
          {
              path: '/DataStatistics',
              name: 'DataStatistics',
              component: DataStatistics,
              meta: {
                  title: '数据统计',
                  icon :'fa fa-user-circle-o font-margin',
                  roles : ['ROLE_admin','ROLE_dba']
              }
          },
          {
              path: '/UserManage',
              name: 'UserManage',
              component: UserManage,
              meta: {
                  title: '用户管理',
                  icon :'fa fa-bar-chart font-margin',
                  roles : ['ROLE_admin','ROLE_dba','ROLE_user']
              }
          },
      ]


    },










]

const router = new VueRouter({
  routes
})

export default router
